/****************************** Module Header ******************************\
* Module Name:	ImportDirective.h
* Project:		CppCOMClient
* Copyright (c) Microsoft Corporation.
* 
* #import (http://msdn.microsoft.com/en-us/library/8etzzkb6.aspx), a new 
* directive that became available with Visual C++ 5.0, creates VC++ "smart 
* pointers" from a specified type library. It is very powerful, but often not 
* recommended because of reference-counting problems that typically occur when 
* used with the Microsoft Office applications. Unlike the direct API approach 
* in RawAPI.h/cpp, smart pointers enable us to benefit from the type info to 
* early/late bind the object. #import takes care of adding the messy guids to 
* the project and the COM APIs are encapsulated in custom classes that the 
* #import directive generates.
* 
* The differences between early binding and late binding via smart pointers:
* 
* Smart pointers make creating an object that supports early binding easy, so 
* does it make creating a late bound object. The only difference between early 
* binding and late binding via smart pointer is the .tlh and .tli files 
* generated by the #import directive. If the target object supports early 
* binding, the .tlh and .tli files will make use of the custom interface (not 
* IDispatch) to call the target property/method directly. If the target COM 
* object only support late binding, the smart pointer takes care of converting 
* your method calls into GetIDsOfNames()s and Invoke()s of the IDispatch 
* interface.
* 
* References
*  http://support.microsoft.com/kb/169496
* 
* This source is subject to the Microsoft Public License.
* See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
* All other rights reserved.
* 
* History:
* * 1/12/2009 10:23 PM Jialiang Ge Created
\***************************************************************************/

#pragma once

#pragma region Includes
#include <ole2.h> // OLE2 Definitions
#pragma endregion


/*!
 * \brief
 * ImportCSharpComponent - Create and access a STA COM object written in C# 
 * by using the smart pointer class and the #import compiler directive.
 * 
 * \param lpParam
 * \returns
 * The prototype of a function that serves as the starting address for a 
 * thread
 * 
 * \remarks
 * In ImportDirective.cpp, the differences between #import-ing a native COM 
 * object and #import-ing a .NET (C#) COM object are highlighted.
 */
DWORD WINAPI ImportCSharpComponent(LPVOID lpParam);